package cc.bookcloud.springboot3.auth;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

@Slf4j
@SpringBootApplication
public class AuthApplication {
    // 取配置文件内容
    @Value("${spring.application.name}")
    private String appName;

    @Value("${server.port}")
    private String port;


    public static void main(String[] args) {
        System.out.println("=========== 启动授权服务器 =========");
        SpringApplication.run(AuthApplication.class, args);
    }

@Bean
    public CommandLineRunner commandLineRunner(Environment env) {
        return args -> {
            System.out.println("当前激活的配置文件: " + String.join(", ", env.getActiveProfiles()));
            System.out.println("spring.application.name: " + env.getProperty("spring.application.name"));
            System.out.println("server.port: " + env.getProperty("server.port"));
            System.out.println("===============================");
        };
    }
}